<template>
  <div class="ui-datagrid-header margin-t20 flex">
    <el-button type="primary" size="small"   @click.native="readCard">读取身份证</el-button>
  </div>
</template>
<script>
import { FmlTools } from "@/utils";//我的动态创建元素的方法放于的文件夹
import { ReadIdNum } from "@/utils/idcardOcx.js";
export default {
  name: "fmlPersonInfo",
  data() {
    return {
    }
  },
  methods: {
    //   读取二代身份证
    readCard() {
      let result = ReadIdNum(this);
        if (typeof result == "object" && result.idcardNo) {
          console.log(result.idcardNo)//此处可输入读卡中的身份证号
        }
    },
  mounted() {
    //由于页面中有多处使用到同一ocx方法，避免重复创建进行对应的判断处理创建对应的object元素
    let obj = document.getElementsByTagName("object");
    let flag = false;
    for (let i = 0; i < obj.length; i++) {
      if (obj[i].getAttribute("id") == "ZJRCEP") return (flag = true);
    }
    if (!flag) {
      let body = document.getElementsByTagName("body")[0];
      FmlTools.domAppend(body);
    }
  }
};
</script>
<style lang="scss">
.pagination {
  text-align: center;
  margin-top: 20px;
}
.fml-print-none {
  position: absolute;
  z-index: -1;
}
</style>